<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:be="clr-namespace:LogGrok.Infrastructure.Behaviors;assembly=LogGrok.Infrastructure"
                    xmlns:logview="clr-namespace:LogGrok.LogView;assembly=LogGrok.LogView">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="ItemStyle" TargetType="{x:Type ListViewItem}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">

                    <Grid MinHeight="{TemplateBinding MinHeight}" Margin="-2,0,0,0">

                        <Grid.InputBindings>
                            <MouseBinding Gesture="LeftDoubleClick" 
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}, Path=DataContext.AddSingleLineToScratchPad}"
                                CommandParameter="{Binding}" />
                        </Grid.InputBindings>

                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="1"
                                SnapsToDevicePixels="True" />

                        <GridViewRowPresenter Margin="2,0,-4,0"
                                              VerticalAlignment="Stretch"
                                              Columns="{TemplateBinding GridView.ColumnCollection}"
                                              Content="{TemplateBinding Content}" />
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{StaticResource AccentColorBrush3}" />
                            <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush2}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{StaticResource AccentColorBrush4}" />
                            <Setter Property="BorderBrush" Value="{StaticResource HighlightBrush}" />
                        </MultiTrigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{StaticResource AccentColorBrush}" />
                            <Setter Property="BorderBrush" Value="{StaticResource HighlightBrush}" />
                        </MultiTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding HasTextColor}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="False" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="{Binding Background}" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{Binding Foreground}" />
                                </Setter.Value>
                            </Setter>
                        </MultiDataTrigger>


                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>


    </Style>

</ResourceDictionary>